#pragma	once			/*  */


#include	"../Headers/types.h"			/*  */
#include	"../Headers/config.h"			/*  */
#include	"../Headers/log.h"			/*  */
#include  "../Headers/authr.h"
#include  "../Headers/nsr.h"
#include  "fs.rpc.h"
#include  "fs.file.h"
#include  <string>
#include  <functional>
#include  <iostream>


namespace TOB {
	
	/*
	 * =====================================================================================
	 *        Class:  FS_Client
	 *  Description:  file sharing client
	 * =====================================================================================
	 */
	class FS_Client : public AuthRequired
	{
		public:
			/* ====================  LIFECYCLE     ======================================= */
			FS_Client (Nameserver::IP nsip, std::string username, std::string password);  /* constructor */
			~FS_Client();																																	/* destructor */
			/* *
			 * upload file 
			 * @param fileName       File Name
			 * @param fileId	     Variable for storage file id
			 * @return 				 Error code
			 * */
			Code::Type upload(std::string fileName, uint32 * fileId);
			/* *
			 * download file
			 * @param id			 File id
			 * @param src			 string constains file name
			 * @param path			 path to download folder
			 * @return				 Error code
			 * */
			Code::Type download(uint32 id, std::string& src, std::string path);
			std::function<void(float, uint32)> onProgress;
		private:
			File f;
			CLIENT * clnt;
		  /* *
			 * Send upload request
			 * @param fileName File name 
			 * @return 				 (fileId, count)
			 * */	
			request upload_request(std::string fileName);
			/* ====================  DATA MEMBERS  ======================================= */

	}; /* -----  end of class FS_Client  ----- */

}
